package com.middlegroup.payadmin.mapper;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.middlegroup.payadmin.pojo.dto.SubjectDto;
import com.middlegroup.payadmin.pojo.po.Subject;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 主体表 Mapper 接口
 * </p>
 *
 * @author pc123
 * @since 2019-01-04
 */
public interface SubjectMapper extends BaseMapper<Subject> {

    @Select("SELECT t1.*,from_unixtime(t1.add_time/1000) gmtCreate,from_unixtime(t1.update_time/1000) gmtModified FROM t_subject t1 where t1.name like concat(#{name},'%') and t1.code like concat(#{code},'%')")
    List<SubjectDto> listSubjectByName(@Param("name") String name,@Param("code") String code);

    @Select("select * from t_subject where code=#{code}")
    Subject getSubjectByCode(@Param("code") String code);
}
